package com.erp.pro.controller;

import com.erp.common.utils.PageUtils;
import com.erp.common.utils.Query;
import com.erp.pro.domain.OutreportprojectDO;
import com.erp.pro.domain.OutreportskuDO;
import com.erp.pro.domain.OutstockDO;
import com.erp.pro.service.OutReportService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * @Auther: Eric
 * @Date: 2020-01-10 13:40
 * @Description:
 */
@Controller
@RequestMapping("/pro/outreport")
public class OutReportController {

    @Autowired
    private OutReportService outReportService;

    @GetMapping("/tooutreportbysku")
    String tooutreportbysku(){
        return "pro/outreport/outreportbysku";
    }

    @ResponseBody
    @GetMapping("/listbysku")
    public PageUtils listbysku(@RequestParam Map<String, Object> params){
        //查询列表数据
        Query query = new Query(params);
        List<OutreportskuDO> outreportskuDOList = outReportService.listbysku(query);
        int total = outReportService.countbysku(query);
        PageUtils pageUtils = new PageUtils(outreportskuDOList, total);
        return pageUtils;
    }


    @GetMapping("/tooutreportbyproject")
    String tooutreportbyproject(){
        return "pro/outreport/outreportbyproject";
    }

    @ResponseBody
    @GetMapping("/listbyproject")
    public PageUtils listbyproject(@RequestParam Map<String, Object> params){
        //查询列表数据
        Query query = new Query(params);
        List<OutreportprojectDO> outreportprojectDOList = outReportService.listbyproject(query);
        int total = outReportService.countbyproject(query);
        PageUtils pageUtils = new PageUtils(outreportprojectDOList, total);
        return pageUtils;
    }
}
